{{extends file="index.html"}}
{{block name = "cssjs"}}
<link rel="stylesheet" href="vendor/select2/select2.min.css">
<style>
    .form-group {
        margin-top: 30px;
    }
</style>
<script type="text/javascript" src="vendor/select2/select2.full.min.js"></script>
<script type="text/javascript" src="vendor/ckfinder/ckfinder.js"></script>
<script type="text/javascript" src="vendor/ckeditor/ckeditor.js"></script>
{{/block}}
{{block name=nav}}编辑栏目{{/block}}
{{block name=title}}编辑栏目
<hr/>{{/block}}
{{block name=notice}}{{/block}}

{{block name=main}}

<div class="panel panel-default">
    <div class="panel-heading">
        <span class="fa fa-align-justify fa-2x" aria-hidden="true" style="float: left;margin-top: 5px"> </span>
        <ul id="myTab" class="nav nav-tabs">
            <li class="active"><a href="#home" data-toggle="tab" style="padding: 0;margin-left: 10px">
                <h4>编辑栏目</h4></a>
            </li>

            <li class="">
                <a href="#ios" data-toggle="tab" style="padding: 0;margin-left: 10px">
                    <h4>栏目内容</h4></a>
            </li>
        </ul>
    </div>

    <div class="panel-body">
        <form class="form-horizontal" role="form" action="index.php?c=column&a=do_edit&id={{$cate1.id}}" method="post">
            <div class="row">

                <div id="myTabContent" class="tab-content">
                    <div class="tab-pane fade in active" id="home">
                        <div class="form-group">
                            <label class="control-label col-md-2" style="text-align: center">父栏目</label>
                            <div class="col-md-10">
                                <select class="js-example-basic-single" style="width:60%" name="pid">
                                   <option value="0">顶级栏目</option>
                                    {{foreach $cates as $cate}}
                                    <option value="{{$cate.id}}"
                                            {{if $cate1.pid eq $cate.id}}
                                    selected='selected';
                                    {{/if}}
                                            >
                                        {{for $i=0; $i<$cate.count; $i++ }}
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        {{/for}}
                                        {{$cate.cateName}}
                                    </option>
                                    {{/foreach}}
                                </select>
                            </div>
                        </div>

                        <div class="form-group" style="">
                            <label for="title" class="col-md-2" style="text-align: center">名称</label>

                            <div class="col-md-10">
                                <input type="text" class="form-control" id="title"
                                       placeholder="栏目名称" name="cateName" style="width:40%" value="{{$cate1.cateName}}">
                            </div>
                        </div>

                        <div class="form-group" style="">
                            <label for="pinyin" class="col-md-2" style="text-align: center">拼音</label>

                            <div class="col-md-10">
                                <input  disabled type="text" class="form-control" id="pinyin"
                                       placeholder="栏目拼音" name="pinyin" style="width:40%" value="{{$cate1.pinyin}}">
                            </div>
                        </div>

                        <div class="form-group" style="">
                            <label for="type" class="col-md-2" style="text-align: center">类型</label>


                            <div class="col-md-10" id="type">
                                <input type="radio" name="type"  id="" value="0"
                                       {{if $cate1.type eq 0}}
                                checked="checked"
                                {{/if}}
                                      />封面
                                <br/>
                                <input type="radio" name="type" value="1"
                                {{if $cate1.type eq 1}}
                                checked="checked"
                                {{/if}}
                                        />列表
                                <br/>
                                <input type="radio" name="type" value="2"
                                {{if $cate1.type eq 2}}
                                checked="checked"
                                {{/if}}
                                        />URL跳转
                            </div>
                        </div>



                        <div class="form-group" style="">
                            <label for="address" class="col-md-2" style="text-align: center">URL跳转地址</label>

                            <div class="col-md-10">
                                <input type="text" class="form-control" id="address" value="{{$cate1.address}}"
                                       placeholder="如果选择了URL跳转，请填写地址" name="address" style="width:40%">
                            </div>
                        </div>

                        <div class="form-group" style="">
                            <label for="" class="col-md-2" style="text-align: center">是否显示</label>

                            <div class="col-md-10">
                                <input type="radio" name="is_show"   value="1"
                                {{if $cate1.is_show eq 1}}
                                checked="checked"
                                {{/if}}
                                        />是
                                <br/>
                                <input type="radio" name="is_show" value="0"
                                {{if $cate1.is_show eq 0}}
                                checked="checked"
                                {{/if}}
                                        />否
                            </div>
                        </div>
                    </div>

                    <div class="tab-pane fade" id="ios">
                        <div class="editor">
                            <textarea name="content" class="">{{$cate1.content}}</textarea>
                        </div>
                        <br/>
                        <br/>
                    </div>
                </div>


            </div>
            <div class="col-md-4 col-md-offset-5">
                <button class="btn btn-success" type="submit">修改</button>
                <button class="btn btn-danger">返回</button>
            </div>
        </form>

    </div>
</div>


<script>
    CKEDITOR.replace('content',
            {
                filebrowserBrowseUrl: '/vendor/ckfinder/ckfinder.html',
                filebrowserImageBrowseUrl: '/vendor/ckfinder/ckfinder.html?type=Images',
                filebrowserFlashBrowseUrl: '/vendor/ckfinder/ckfinder.html?type=Flash',
                filebrowserUploadUrl: '/vendor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
                filebrowserImageUploadUrl: '/vendor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
                filebrowserFlashUploadUrl: '/vendor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
            });

    $(function () {
        $(".js-example-basic-single").select2();
//        $('#myTab li:eq(1) a').tab('show');
    });

</script>


{{/block}}